package com.njtoyo.taxi.admin.rest.controller.marketing;


import com.njtoyo.taxi.admin.rest.wrapper.marketing.freeCommission.FreeCommissionCardAddWrapper;
import com.njtoyo.taxi.admin.rest.wrapper.marketing.freeCommission.FreeCommissionCardQueryWrapper;
import com.njtoyo.taxi.admin.rest.wrapper.marketing.freeCommission.FreeCommissionCardUpdateWrapper;
import com.njtoyo.taxi.admin.service.marketing.CouponPurchaseRuleService;
import com.taxi.entity.common.RestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/marketing/free-commission-card")
public class CouponPurchaseRuleController {

    @Autowired
    private CouponPurchaseRuleService freeCommissionCardService;


    @GetMapping("/list")
    public RestResult list(FreeCommissionCardQueryWrapper wrapper) {
        return freeCommissionCardService.list(wrapper);
    }


    @PostMapping("/add")
    public RestResult add(@RequestBody FreeCommissionCardAddWrapper wrapper) {
        return freeCommissionCardService.add(wrapper);
    }


    @PostMapping("/update")
    public RestResult update(@RequestBody FreeCommissionCardUpdateWrapper wrapper) {
        return freeCommissionCardService.update(wrapper);
    }

    @PostMapping("/{id}/delete")
    public RestResult delete(@PathVariable("id") Long id) {
        return freeCommissionCardService.delete(id);
    }

    /**
     * 开启关闭
     *
     * @param wrapper
     * @return
     */
    @PostMapping("/updateActive")
    public RestResult updateActive(@RequestBody FreeCommissionCardUpdateWrapper wrapper) {
        return freeCommissionCardService.updateActive(wrapper);
    }
}
